package org.mashibing.controller;

import org.mashibing.dto.ResponseResult;
import org.mashibing.request.OrderRequest;
import org.mashibing.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author:
 * @create: 2024/7/4 10:41
 * @description: 订单相关
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    OrderService orderService;
    /**
     * 创建订单/下单
     */
    @PostMapping("/add")
    public ResponseResult add(@RequestBody OrderRequest orderRequest){
        System.out.println(orderRequest);
//        return ResponseResult.fail(9,"参数校验通过");
        return orderService.add(orderRequest);
    }
}
